// @description 客户管理
// @author yurui
// @createDate 2020.08.15
// @version v1.0.0
import { defHttp } from '/@/utils/http/axios';
import { ApiCommon  } from '../common'
const { CUSTOMER_METER_API, SYS_ADMIN_API, CUSTOMER_ADMIN_API, READING_ADMIN_API } = ApiCommon;
// /v1.0/sys/admin/user/readers
const MANAGELIST_API = `${CUSTOMER_METER_API}/reading/book`;
const USER_READERS_DICT = `${SYS_ADMIN_API}/user`;
const DEPT_TREE_API = `${SYS_ADMIN_API}/dept`;
const NEW_CUSTOMER_ADMIN_API = `${CUSTOMER_ADMIN_API}/reading-route`;
enum Api {
    MANAGELIST_PAGE = "/page", //分页查询客户
    MANAGELIST_CREATE = "/create",//创建表册
    MANAGELIST_UPDATE = "/update",//更新表册
    MANAGELIST_DELETE = '/delete',//删除用户信息 /v1.0/mcduser/admin/user/delete/{userId}
    ADMIN_READERS = '/readers', //字典--抄表员
    CUSTOMER_ADMIN_LIST = '/list', //片区列表
    DEPT_TREE = '/tree', //获取当前用户所属部门-树形图
    WATER_ALGORITHM = '/detail/water-algorithm' // 查询水量预估
  }
  /**
   * @description: 请求的API地址
   */
  export const pageApi = (params:object) => defHttp.get({ url: MANAGELIST_API + Api.MANAGELIST_PAGE, params });//查询表册
  export const createApi = (params:object) => defHttp.post({ url: MANAGELIST_API + Api.MANAGELIST_CREATE, params });//创建表册
  export const updateApi = (params:object) => defHttp.put({ url: MANAGELIST_API + Api.MANAGELIST_UPDATE, params });//更新表册
  export const deleteApi = (params:object) => defHttp.delete({ url: MANAGELIST_API + Api.MANAGELIST_DELETE+ `?id=${params.id}` });//删除表册
  export const adminReadersApi = (params:object) => defHttp.get({ url: USER_READERS_DICT + Api.ADMIN_READERS, params }); //字典--抄表员
  export const waterAlgorithmApi = (params:object) => defHttp.post({ url: READING_ADMIN_API + Api.WATER_ALGORITHM, params }); //查询水量预估
  export const readingRoutePageApi = (params: object) => defHttp.get({ url: NEW_CUSTOMER_ADMIN_API + Api.CUSTOMER_ADMIN_LIST + `${params?.dept_id ? `/${params?.dept_id}` : ''}` });//片区列表
  export const bookListApi = (params?: object) => defHttp.get({ url: MANAGELIST_API + Api.CUSTOMER_ADMIN_LIST, params });//表册列表
  export const deptTreeApi = () => defHttp.get({ url: DEPT_TREE_API + Api.DEPT_TREE }); //获取当前用户所属部门-树形图



  
  